package com.nPones;

import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.os.Process;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.Window;
import mainSrc.GlobalData;
import mainSrc.GlobalSaveData;
import mainSrc.MainDirector;

public class MainActivity
  extends Activity
{
  GameView MainGame;
  
  public void MessageBox(CharSequence paramCharSequence)
  {
    new AlertDialog.Builder(this).setTitle("nPone's Game").setMessage(paramCharSequence).setNeutralButton("OK", new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
    }).show();
  }
  
  public void QuitGame()
  {
    if (GlobalSaveData.GetInstance().iLanguage == 0)
    {
      new AlertDialog.Builder(this).setTitle("nPone's Game").setMessage("What do you want to exit?").setPositiveButton("Activity", new DialogInterface.OnClickListener()
      {
        public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
        {
          paramAnonymousDialogInterface = new Intent();
          paramAnonymousDialogInterface.setAction("android.intent.action.MAIN");
          paramAnonymousDialogInterface.addCategory("android.intent.category.HOME");
          MainActivity.this.startActivity(paramAnonymousDialogInterface);
        }
      }).setNeutralButton("Process", new DialogInterface.OnClickListener()
      {
        public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
        {
          MainActivity.this.StopServiceView();
          MainActivity.this.StopServiceViewRE1();
          MainActivity.this.StopServiceViewRE2();
          MainActivity.this.StopServiceViewRE3();
          MainActivity.this.recycleObject();
          Process.killProcess(Process.myPid());
        }
      }).setNegativeButton("Cancle", new DialogInterface.OnClickListener()
      {
        public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
      }).show();
      return;
    }
    new AlertDialog.Builder(this).setTitle("nPone's Game").setMessage("게임을 종료하시겠습니까?").setPositiveButton("종료", new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        paramAnonymousDialogInterface = new Intent();
        paramAnonymousDialogInterface.setAction("android.intent.action.MAIN");
        paramAnonymousDialogInterface.addCategory("android.intent.category.HOME");
        MainActivity.this.startActivity(paramAnonymousDialogInterface);
      }
    }).setNeutralButton("프로세스", new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        MainActivity.this.StopServiceView();
        MainActivity.this.StopServiceViewRE1();
        MainActivity.this.StopServiceViewRE2();
        MainActivity.this.StopServiceViewRE3();
        MainActivity.this.recycleObject();
        Process.killProcess(Process.myPid());
      }
    }).setNegativeButton("취소", new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
    }).show();
  }
  
  public void StartServiceView()
  {
    switch (GlobalData.GetInstance().character_call)
    {
    default: 
      return;
    case 0: 
      startService(new Intent(this, pck_Service01.service_TopView.class));
      pck_Service01.service_ServiceGlobal.SetData();
      localGlobalData = GlobalData.GetInstance();
      localGlobalData.character_call += 1;
      return;
    case 1: 
      startService(new Intent(this, pck_Service02.service_TopView.class));
      pck_Service02.service_ServiceGlobal.SetData();
      localGlobalData = GlobalData.GetInstance();
      localGlobalData.character_call += 1;
      return;
    }
    startService(new Intent(this, pck_Service03.service_TopView.class));
    pck_Service03.service_ServiceGlobal.SetData();
    GlobalData localGlobalData = GlobalData.GetInstance();
    localGlobalData.character_call += 1;
  }
  
  public void StopServiceView()
  {
    switch (GlobalData.GetInstance().character_call)
    {
    }
    for (;;)
    {
      GlobalData.GetInstance().character_call = 0;
      return;
      pck_Service03.service_ServiceGlobal.bRecycle = true;
      pck_Service02.service_ServiceGlobal.bRecycle = true;
      pck_Service01.service_ServiceGlobal.bRecycle = true;
    }
  }
  
  public void StopServiceViewRE1()
  {
    GlobalData.GetInstance().character_call = 0;
    stopService(new Intent(this, pck_Service01.service_TopView.class));
  }
  
  public void StopServiceViewRE2()
  {
    GlobalData.GetInstance().character_call = 0;
    stopService(new Intent(this, pck_Service02.service_TopView.class));
  }
  
  public void StopServiceViewRE3()
  {
    GlobalData.GetInstance().character_call = 0;
    stopService(new Intent(this, pck_Service03.service_TopView.class));
  }
  
  protected void onCreate(Bundle paramBundle)
  {
    getWindow().addFlags(128);
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    this.MainGame = new GameView(getBaseContext(), null, this);
    setContentView(this.MainGame);
  }
  
  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131165184, paramMenu);
    return true;
  }
  
  protected void onDestroy()
  {
    recycleObject();
    super.onDestroy();
  }
  
  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    switch (paramInt)
    {
    default: 
      return super.onKeyDown(paramInt, paramKeyEvent);
    }
    QuitGame();
    return true;
  }
  
  public void recycleObject()
  {
    Log.v("test", "Ondestroy : Recycle Bitmap");
    if (this.MainGame != null)
    {
      if (this.MainGame.m_director != null)
      {
        this.MainGame.m_director.recycleBitmap();
        Log.v("test", "Ondestroy : Recycle Bitmap Complete");
        return;
      }
      Log.v("test", "Ondestroy : MainGame.m_director is null");
      return;
    }
    Log.v("test", "Ondestroy : MainGame is null");
  }
}


/* Location:           D:\Tool\AndroidKiller_v1.3.1\projects\petdesigner\ProjectSrc\classes-dex2jar.jar
 * Qualified Name:     com.nPones.MainActivity
 * JD-Core Version:    0.7.0.1
 */